//
//  DFheadNewsView.m
//  DFMessage
//
//  Created by lanou on 15/10/26.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "DFheadNewsView.h"
#import "Header.pch"
#import "UIImageView+WebCache.h"
#import "NewsVideoModel.h"
#import "DFSignlTon.h"
@implementation DFheadNewsView

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _imgsrcImage = [[UIImageView alloc]init];
        CGFloat lx = kScreenWidth/4;
        _imgsrcImage.frame = CGRectMake(5, 8, lx, lx*3/4);
        [self.contentView addSubview:_imgsrcImage];
        
        _video_timeLabel = [[UILabel alloc]init];
        _video_timeLabel.frame = CGRectMake(5, lx * 3 / 4 - 2, lx, 10);
        _video_timeLabel.backgroundColor = [UIColor lightGrayColor];
        _video_timeLabel.font = [UIFont systemFontOfSize:11];
        _video_timeLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_video_timeLabel];
        
        _stitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(lx + 10, 0, lx * 3 - 16, 50)];
        _stitleLabel.numberOfLines = 0;
        _stitleLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_stitleLabel];
        
        _sdateLabel = [[UILabel alloc]initWithFrame:CGRectMake(lx + 10, 55, 100, 15)];
        _sdateLabel.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:_sdateLabel];
        
        _tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth/2, 55, 100, 15)];
        _tagLabel.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:_tagLabel];
        
        _play_countLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth - 80, 55, 50, 15)];
        _play_countLabel.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:_play_countLabel];
        
        UILabel *play = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 32, 55, 30, 15)];
        play.text = @"播放";
        play.font = [UIFont systemFontOfSize:11];
        [self.contentView addSubview:play];
        
//        UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, kScreenWidth, 2)];
//        line.backgroundColor = [UIColor lightGrayColor];
//        [self.contentView addSubview:line];
    }
    return self;
}



-(void)setConfigureModel:(NewsVideoModel *)configureModel{
    
    _configureModel = configureModel;
    
    DFSignlTon *signlTon = [DFSignlTon shareInstance];
    if (signlTon.savemode == SaveModeYes)
    {
        _imgsrcImage.image = [UIImage imageNamed:@""];
    }else
    {
        [_imgsrcImage sd_setImageWithURL:[NSURL URLWithString:configureModel.imgsrc]];
    }
    
    _video_timeLabel.text = [NSString stringWithFormat:@"%@",configureModel.video_time];
    
    _stitleLabel.text = configureModel.stitle;
    
    NSString *str = configureModel.sdate;
    
    _sdateLabel.text = [str substringToIndex:10];
    
    _tagLabel.text = configureModel.tag;
    
    _play_countLabel.text = [NSString stringWithFormat:@"%@",configureModel.play_count];
    
    _label.text = [NSString stringWithFormat:@"%@",configureModel.label];
  
}

@end
